oldlon = wpt->longitude;
oldlat = wpt->latitude;
- if (strcmp(xcsv_file.field_delimiter, "\\w") == 0)
+ if (xcsv_file.field_delimiter && strcmp(xcsv_file.field_delimiter, "\\w") == 0)
write_delimiter = " ";
else
write_delimiter = xcsv_file.field_delimiter;
sprintf(buff, fmp->printfc, waypt_out_count + atoi(fmp->val));
} else
if (strcmp(fmp->key, "CONSTANT") == 0) {
- sprintf(buff, fmp->printfc, fmp->val);
+ const char *cp = xcsv_get_char_from_constant_table(fmp->val);
+ if (cp) {
+ sprintf(buff, fmp->printfc, cp);
+ } else {
+ sprintf(buff, fmp->printfc, fmp->val);
+ }
} else
if (strcmp(fmp->key, "SHORTNAME") == 0) {
sprintf(buff, fmp->printfc,
void
xcsv_destroy_style(void);
+const char *
+xcsv_get_char_from_constant_table(char *key);
+
/****************************************************************************/
/* types required for various xcsv functions */
/****************************************************************************/
xcsv_file.is_internal = internal;
}
-static const char *
-get_char_from_constant_table(char *key)
+const char *
+xcsv_get_char_from_constant_table(char *key)
{
char_map_t *cm = xcsv_char_table;
if (strlen(sbuff)) {
if (ISSTOKEN(sbuff, "FIELD_DELIMITER")) {
sp = csv_stringtrim(&sbuff[16], "\"", 1);
- cp = get_char_from_constant_table(sp);
+ cp = xcsv_get_char_from_constant_table(sp);
if (cp) {
xcsv_file.field_delimiter = xstrdup(cp);
xfree(sp);
if (ISSTOKEN(sbuff, "RECORD_DELIMITER")) {
sp = csv_stringtrim(&sbuff[17], "\"", 1);
- cp = get_char_from_constant_table(sp);
+ cp = xcsv_get_char_from_constant_table(sp);
if (cp) {
xcsv_file.record_delimiter = xstrdup(cp);
xfree(sp);
if (ISSTOKEN(sbuff, "BADCHARS")) {
sp = csv_stringtrim(&sbuff[9], "\"", 1);
- cp = get_char_from_constant_table(sp);
+ cp = xcsv_get_char_from_constant_table(sp);
if (cp) {
p = xstrdup(cp);